<template>
	<div>
		<div style="margin-top: 1rem;">考试管理</div>
		<div style="margin-top: 1.25rem;">
			所属题库：
			<el-select v-model="value" placeholder="请选择">
				<el-option v-for="item in MyAllQuestionBank" :key="item.id" :label="item.questionBankName" :value="item.id">
				</el-option>
			</el-select>
		</div>
		<el-table :data="TestPapersByBankId" border style="width: 90%;margin-top: 1.25rem;">
			<el-table-column prop="questionBankName" label="题库名称" width="180">
			</el-table-column>
			<el-table-column prop="questionBankDescribe" label="题库描述" width="180">
			</el-table-column>
			<el-table-column prop="createTime" label="创建时间">
			</el-table-column>
			<el-table-column prop="" label="操作">
				<template slot-scope="scope">
					<el-button type="success" icon="el-icon-search" circle @click="Serchtest()"></el-button>
					<el-button type="primary" icon="el-icon-edit" circle @click="handledit(scope.$index, scope.row)"></el-button>
					<el-button type="danger" icon="el-icon-delete" circle @click="deleteBank(scope.row.id)"></el-button>
				</template>
			</el-table-column>
		</el-table>

	</div>
</template>

<script>
	import {
		HttpManager
	} from "../../../../request/Teacher.js"
	export default {
		data() {
			return {
				options: [{
					value: '选项1',
					label: '黄金糕'
				}, {
					value: '选项2',
					label: '双皮奶'
				}, {
					value: '选项3',
					label: '蚵仔煎'
				}, {
					value: '选项4',
					label: '龙须面'
				}, {
					value: '选项5',
					label: '北京烤鸭'
				}],
				value: '',
				MyAllQuestionBank:[],
				id:this.$route.query.id,
				TestPapersByBankId:[]
			}
		},
		methods: {
			//根据题库id获取试卷信息
			getTestPapersByBankId(id) {
                this.id=id;
				var parmas = {
					questionBankId:this.id //	题库id
				}
				HttpManager.getTestPapersByBankId(parmas).then(e => {
					console.log(e);
					this.TestPapersByBankId=e.data.data;
				})
			},
			//获取自己所有的试题库
			getMyAllQuestionBank() {
				HttpManager.getMyAllQuestionBank().then(e => {
					console.log(e);
					this.MyAllQuestionBank = e.data.data;
				})
			},
		},
		created() {
			this.getMyAllQuestionBank();
			this.getTestPapersByBankId(this.id);
		}
	}
</script>

<style>
</style>
